import a from './test'
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
import { createApp } from 'vue';

console.log(a, 'a1')
export default function initMain(config = {}) {
  let instance = null;
  
  function render(props = {}) {
    const { container } = props;
    instance = createApp(config.vueArgs);
    instance.mount(container ? container.querySelector('#app') : '#app');
  }

  // 独立运行时
  if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
    render();
  }

  function bootstrap() {
    console.log('[vue] vue app bootstraped');
  }
  function mount(props) {
    console.log('[vue] props from main framework', props);
    render(props);
  }
  function unmount() {
    instance.$destroy();
    instance.$el.innerHTML = '';
    instance = null;
    router = null;
  }
  return {
    bootstrap,
    mount,
    unmount
  }
}
console.log(DEFINE_IS_NATIVE_DEV, 'DEFINE_IS_NATIVE_DEV')
